﻿<%@ Page Language="C#" %>

<%@ Import Namespace="wojilu" %>
<%@ Import Namespace="wojilu.View" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Domain" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Service" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>#{softtitle}</title>
<link href="#{path.css}ybb/css/baselist.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/all.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/formdiv.css?v=#{cssVersion}" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="#{path.js}ybb/js/jquery.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/control.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/form.js?v=#{jsVersion}"></script>
<script type="text/javascript">
	var resizewindow= null;
	window.onresize = function(){
		var h = $(window).height();
		if(resizewindow!=h){
			sizewindow();
			resizewindow=h;
		}
	}
	function sizewindow(){
		var h = $(window).height();
		if(document.getElementById("mainbodybottonauto")){
			$('.managebottonadd').css({height:h-40});
		}
	}
	var grouplist_js_powername_empty = "_{grouplist_js_powername_empty}";
	var grouplist_js_add_ok = "_{grouplist_js_add_ok}";
	var grouplist_js_add_no = "_{grouplist_js_add_no}";
	var iframename = "#{iframename}";
	iframename = iframename=='' ? "jerichotabiframe_0" : iframename;
	$(document).ready(function(){
	    var h = '#{iframeheightwindow}';
		$('.managebottonadd').css({height:h-40});
		var options = {

			beforeSubmit: formverify,

			success:saveResponse,
			resetForm: true
		}
		$('#poweradd').submit(function() {
			$(this).ajaxSubmit(options);
			return false;
		});
	})
	function formverify(formData) {
		var queryString = $.param(formData);
		var get=urlarray(queryString);
		if(get['powername']==""){
			document.poweradd.powername.focus();
			alert(grouplist_js_powername_empty);
			return false;
		}
		parent.windowsdig('Loading','iframe:#{load}','400px','180px','iframe',false);
	}
	function saveResponse(options){
		parent.closeifram();
		var tab=document.getElementById("poweraddtab").value;
		if (options=='true'){
			if (tab=='true'){
				if(parent.frames[iframename].document.getElementById("selectform")){
					parent.frames[iframename].refresh('selectform','selectall','check_all');
				}
			}
			alert(grouplist_js_add_ok);
		}else{
			alert(grouplist_js_add_no);
		}
		if (tab=='true'){
			parent.onaletdoc()
		}
	}
</script>
</head>

<body>
<form name="poweradd" id="poweradd" method="post" action="#{ActionLink}">
<input type="hidden" name="tab" id="poweraddtab" value="#{tab}" />
<div id="mainbodybottonauto" class="managebottonadd">
	<div class="maindobycontent">
		<div class="suggestion">
			<span class="sugicon"><span class="strong colorgorning2">_{position_title}</span><span class="colorgorningage">_{grouplist_add_mess}</span></span>
		</div>
		<div class="manageeditdiv">
			<div class="maneditcontent">
				<table class="formtable">
					<tr class="trstyle2">
						<td class="trtitle01">_{grouplist_add_powername}</td>
						<td class="trtitle02"><input type="text" name="powername" size="25" maxlength="20" class="infoInput"/> <span class="cautiontitle">_{grouplist_add_powername_mess}</span></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle01">_{grouplist_add_powerlist}</td>
						<td class="trtitle02">
							<table width="100%" border="0" cellspacing="0" cellpadding="2">
                                <%var list = v.data("list") as List<Menulink>; %>
                                <%foreach(var row in list){ %>
								<tr>
									<td colspan="4" style="padding:5px 5px 5px 0px;">
										<input type="checkbox" name="powerlist[]" CHECKED value="<%=row.loadfun %>" id="powerlist">
										<b><%=row.menuname %></b>  <span class="cautiontitle">_{grouplist_add_powerlist_mess}</span>
									</td>
								</tr>
                                <%var list1 = Menulink.find("topmlid=:t").set("t", row.Id).list(); %>
                                <%foreach(var row1 in list1){ %>
								<tr>
									<td colspan="1" style="padding:5px 5px 5px 0px;" valign="top">
										<input type="checkbox" name="powerlist[]" CHECKED value="<%=row1.loadfun %>" id="powerlist"> <%=row1.menuname %>
									</td>
									<td colspan="3">
										<table border="0" cellspacing="0" cellpadding="2">
											<tr>
                                                <%var list2 = Menulink.find("topmlid=:t").set("t", row1.Id).list(); %>
                                            <%var i = 0; %>
											<%foreach(var row2 in list2){ %>
                                            <%i++; %>
												<td style="padding:5px 5px 5px 0px;">
													<input type="checkbox" name="powerlist[]" CHECKED value="<%=row2.loadfun %>" id="powerlist"> <%=row2.menuname %>
												</td>
											<%if(i % 6 ==0){ %></tr><tr><%} %>
											<%} %>
											</tr>
										</table>
									</td>
								</tr>
								<%} %>
								<tr>
									<td colspan="4"><hr></td>
								</tr>
							<%} %>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="2"></td>
					</tr>
				</table>
			</div>
		</div>
	</div>
</div>
<div id="downbotton">
	<div id="subbotton">
		<table border="0" width="100%">
			<tr>
				<td id="right"><input type="submit" id="submitbotton" name="Submit" value="_{botton_add}" class="buttonface" /></td>
				<td id="left" class="padding-left5"><input type="button" name="cancel" onClick="javascript:parent.onaletdoc();" value="_{botton_add_reset}" class="buttonface" /></td>
			</tr>
		</table>
	</div>
</div>
</form>
</body>

</html>